home *** CD-ROM | disk | FTP | other *** search
- (*----------------------------------------------------------------------*)
- (* Prompt --- Prompt for Command Entry *)
- (*----------------------------------------------------------------------*)
-
- PROCEDURE Prompt;
-
- (*----------------------------------------------------------------------*)
- (* *)
- (* Procedure: Prompt *)
- (* *)
- (* Purpose: Prompts for, reads, parses, and executes command. *)
- (* *)
- (* Calling sequence: *)
- (* *)
- (* Prompt; *)
- (* *)
- (* Calls: Position *)
- (* Issue_Prompt *)
- (* Find_Line *)
- (* Display_Menu *)
- (* Read_Command *)
- (* Skipbl *)
- (* GoToXY *)
- (* Sound *)
- (* Delay *)
- (* NoSound *)
- (* *)
- (*----------------------------------------------------------------------*)
-
- VAR
- legal: BOOLEAN;
- question: BOOLEAN;
- c: CHAR;
-
- BEGIN (* Prompt *)
-
- REPEAT
-
- legal := TRUE;
- question := FALSE;
- (* Issue command prompt *)
- Issue_Prompt;
- (* Read command *)
- Read_Command;
- (* Skip leading blanks *)
- Skipbl;
- (* Null line -- go to next screen *)
-
- IF Command[Cind] = NUL THEN
- Find_Line( bot^.lnum + 1 )
-
- (* Look for EXIT *)
-
- ELSE IF Command[Cind] IN ['E','e','?'] THEN
- BEGIN
- c := Command[Cind];
- Cind := Cind + 1;
- IF Command[Cind] IN ['X','x'] THEN
- BEGIN
- Cind := Cind + 1;
- IF Command[Cind] IN ['I','i'] THEN
- BEGIN
- Cind := Cind + 1;
- IF Command[Cind] IN ['T','t'] THEN
- Cind := Cind + 1
- END
- END;
- (* Skip any trailing blanks *)
- Skipbl;
- (* If legal command, we've reached EOLN *)
-
- Legal := Command[Cind] = NUL;
-
- (* If legal command, then execute it. *)
- IF Legal THEN
-
- CASE c OF
-
- 'E', 'e': done := TRUE;
-
- '?': (* Display Help *)
- BEGIN
- Display_Menu;
- question := TRUE;
- END
- END
- END
- ELSE (* If not EXIT or ?, check if other *)
- (* legal command *)
- Position( legal );
-
- (* Issue beep if not legal command *)
- IF NOT legal THEN
- BEGIN
- Sound( 440 );
- Delay( 500 );
- NoSound;
- END;
-
- UNTIL ( legal AND ( NOT question ) );
-
- END (* Prompt *);